home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / NextAnswers / 1397_assertion_failed_during_lockFocus.rtf < prev    next >
Text File  |  1993-11-08  |  2KB  |  29 lines

  1. {\rtf0\ansi{\fonttbl\f0\fnil Times-Roman;\f1\fmodern Courier;\f2\fmodern Ohlfs;}
  2. \paperw11580
  3. \paperh7980
  4. \margl120
  5. \margr120
  6. {\colortbl;\red0\green0\blue0;\red84\green84\blue84;\red83\green83\blue83;\red82\green82\blue82;}
  7. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b0\i0\ulnone\fs28\fc0\cf0 Q:  
  8. \fc1\cf1 I am trying to draw something to my view and am getting the message:\
  9. \
  10.  
  11. \f1\fs24     Assertion failed: No REAL window during lockFocus on a view\
  12.  
  13. \f0\fs28\fc0\cf0 \
  14. I've checked and the window instance variable of the view is non-nil.  Why am I getting this message?\
  15.     \
  16.  
  17. A:  
  18. \fc1\cf1 A REAL window is a PostScript window.  Your check for a non-nil window assures that you have a AppKit-side window, but it doesn't check to make sure there is an associated PostScript window.  When you grab a window in InterfaceBuilder, it is deferred by default.  When a window is deferred the associated PostScript window won't be created until you actually bring that window on screen.  You cannot draw to a window which doesn't yet have a PostScript window.   You can change the deferred status using the “Deferred” switch button on the InterfaceBuilder Window inspector or with the proper argument to the Window method  (
  19. \b initContent:style:backing:buttonMask:defer:
  20. \b0 ).  If you're ever in doubt about a view's status, you can use the 
  21. \b canDraw
  22. \b0  method which returns a boolean which indicates whether you are able to draw to that view.\
  23. \
  24. QA774\
  25. \
  26. Valid for 1.0, 2.0, 3.0\
  27. \
  28.  
  29.